import { request } from './request'


// 轮播图请求
export function getBanner(type) {
    return request({
        withCredentials: true,
        url: '/banner',
        params: {
            type
        }
    })
}

//热门歌单分类
export function playlist_hot(){
    return request({
        withCredentials: true,
        url:"/playlist/hot"
    })
}

//歌单分类
export function catlist(){
    return request({
        url:"/playlist/catlist",
        withCredentials: true,
    })
}
//歌单页面请求
export function getPlaylist(cat,limit,offset){
    return request({
        withCredentials: true,
        url:"/top/playlist",
        params:{
          cat,
          limit,
          offset
        }
    })
}

//所有榜单
export function toplist(){
    return request({
        url:"/toplist",
        withCredentials: true,
    })
}

//所有榜单内容摘要
export function detail () {
      return request({
        url: "/toplist/detail",
        withCredentials: true,
      })
}

//推荐歌单
export function personalized(limit){
   return request({
       url:"/personalized",
       withCredentials: true,
       params:{
         limit,
         timerstamp:Date.now()
       }
   })
}
// 首页信息
export function getHomepage(refresh) {
    return request({
        url: '/homepage/block/page',
        withCredentials: true,
        params: {
            refresh
        }
    })
}

// 获取新歌曲
export function getNewSong() {
    return request({
        url: '/recommend/songs',
        withCredentials: true,
    })
}

// 热门话题
export function getTopic(limit, offset) {
    return request({
        url: '/hot/topic',
        withCredentials: true,
        params: {
            limit,
            offset
        }
    })
}

// 热门歌单
export function getHotSheet(order, cat = "全部", limit, offset) {
    return request({
        url: '/top/playlist',
        withCredentials: true,
        params: {
            order,
            cat,
            limit,
            offset
        }
    })
}

// 新歌速递
export function getSongsTop(type) {
    return request({
        url: '/top/song',
        withCredentials: true,
        params: {
            type
        }
    })
}

// 推荐节目
export function getProgram() {
    return request({
        url: '/program/recommend',
        withCredentials: true,
    })
}

//音乐首页新碟上架数据
export function album_newest(){
       return request({
           url:'/album/newest',
       })
}

// 新碟上架
export function getNewAlbum(obj) {
    return request({
        url: '/top/album',
        withCredentials: true,
        params: {
            type:obj.type,  //new:全部 hot:热门,默认为 new
            limit:obj.limit, //取出数量 , 默认为 50
            offset:obj.offset, //偏移数量 , 用于分页
            area:obj.area, //ALL:全部,ZH:华语,EA:欧美,KR:韩国,JP:日本
            year:obj.year, //年,默认本年
            month:obj.month //月,默认本月
        }
    })
}

// 热门歌手
export function getHotSinger(limit, offset) {
    return request({
        url: '/top/artists',
        withCredentials: true,
        params: {
            limit,
            offset
        }
    })
}

// 歌单标签列表
export function getSheetTags() {
    return request({
        url: '/playlist/hot',
        withCredentials: true,
    })
}

// 新碟上架
export function getAlbum(limit, offset, area, type) {
    return request({
        url: '/top/album',
        withCredentials: true,
        params: {
            limit,
            offset,
            area,
            type
        }
    })
}
//获取专辑内容
export function album(id){
    return request({
        url:'/album',
        params:{
            id
        }
    })
}
export function artist_album(id , limit){
    return request({
        url:'/artist/album',
        params:{
           id,
           limit
        }
    })
}
// 歌手分类
export function getSinger(limit, offset, type, area) {
    return request({
        url: '/artist/list',
        withCredentials: true,
        params: {
            limit,
            offset,
            type,
            area
        }
    })
} 

// 日推歌曲
export function getRecommendSong(cookie){
    return request({
        url: '/recommend/songs',
        withCredentials: true,
        params: {
            cookie
        }
    })
}
